// maindlg.h : interface of the CMainDlg class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINDLG_H__8367810F_A72A_48BE_A607_CDCB8B7E9127__INCLUDED_)
#define AFX_MAINDLG_H__8367810F_A72A_48BE_A607_CDCB8B7E9127__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#define WM_CONNECTFTP_FINISH	WM_USER + 1

class CFtpMgr;

typedef struct
{
	CFtpMgr *	pFtpMgr;
	HWND		hWnd;
}CONNECT_PARAM, * LPCONNECT_PARAM;

class CMainDlg : public CDialogImpl<CMainDlg>, public CUpdateUI<CMainDlg>,
public CMessageFilter, public CIdleHandler, public CWinDataExchange<CMainDlg>
{
public:
	enum { IDD = IDD_MAINDLG };

	CMainDlg();
	virtual ~CMainDlg();
	virtual BOOL PreTranslateMessage(MSG* pMsg)
	{
		return CWindow::IsDialogMessage(pMsg);
	}

	virtual BOOL OnIdle()
	{
		return FALSE;
	}

	BEGIN_DDX_MAP(CMainDlg)
		DDX_TEXT(IDC_IP_ADDRESS, m_strServer)
 		DDX_TEXT(IDC_EDIT_USER, m_strUser)
 		DDX_TEXT(IDC_EDIT_PWD, m_strPwd)
		DDX_TEXT(IDC_EDIT_PATH, m_strDefaultPath)
	END_DDX_MAP()

	BEGIN_UPDATE_UI_MAP(CMainDlg)	
	END_UPDATE_UI_MAP()

	BEGIN_MSG_MAP(CMainDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		COMMAND_ID_HANDLER(IDOK, OnOK)
		COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
		NOTIFY_HANDLER(IDC_LIST, LVN_BEGINDRAG, OnDrag)
		MESSAGE_HANDLER(WM_DROPFILES, OnDrop)
		MESSAGE_HANDLER(WM_CONNECTFTP_FINISH, OnConnectFtpFinish)
	END_MSG_MAP()

	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnDrop(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnConnectFtpFinish(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	void CloseDialog(int nVal);
	HRESULT OnDrag(int, LPNMHDR, BOOL& );
	void ShowStatus(const CString & strMessage);
private:
	void InitList();

private:
	CListViewCtrl	m_list;
	CString			m_strServer;
	CString			m_strUser;
	CString			m_strPwd;
	CString			m_strDefaultPath;

	CFtpMgr * m_pFtpMgr;
	vector<CString>m_vFileNameList;
	vector<CString>m_vTemp;
};


/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MAINDLG_H__8367810F_A72A_48BE_A607_CDCB8B7E9127__INCLUDED_)
